package com.example.myapplicationktkt2.ui

import android.os.Bundle
import android.widget.Button
import androidx.appcompat.app.AppCompatActivity
import com.example.myapplicationktkt2.R
import es.dmoral.toasty.Toasty

class ToastyDemoActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_toasty_demo)
        
        // 成功Toast示例
        val successButton = findViewById<Button>(R.id.btnSuccessToast)
        successButton.setOnClickListener {
            Toasty.success(this, "操作成功!", Toasty.LENGTH_SHORT, true).show()
        }
        
        // 错误Toast示例
        val errorButton = findViewById<Button>(R.id.btnErrorToast)
        errorButton.setOnClickListener {
            Toasty.error(this, "操作失败!", Toasty.LENGTH_SHORT, true).show()
        }
        
        // 信息Toast示例
        val infoButton = findViewById<Button>(R.id.btnInfoToast)
        infoButton.setOnClickListener {
            Toasty.info(this, "这是一条信息", Toasty.LENGTH_SHORT, true).show()
        }
        
        // 警告Toast示例
        val warningButton = findViewById<Button>(R.id.btnWarningToast)
        warningButton.setOnClickListener {
            Toasty.warning(this, "请注意!", Toasty.LENGTH_SHORT, true).show()
        }
        
        // 普通Toast示例
        val normalButton = findViewById<Button>(R.id.btnNormalToast)
        normalButton.setOnClickListener {
            Toasty.normal(this, "普通消息", Toasty.LENGTH_SHORT).show()
        }
    }
}